<template>
  <div class="risk">
    <!-- <div class="add" @click="add">新增</div> -->
    <eagle-page-list
      ref="eaglePageList"
      @bindData="bindData"
      :queryParams="queryParams"
      :url="'/RiskUnit/GetCodePageData'"
      :conditions="conditions"
      :pageSize="20"
    >
      <template #list>
        <eagle-cell 
          @click="toDangerTemplate(item)"
          style="margin-top: 10px"
          v-for="(item, index) in list"
          :key="index">
          <div>
            <div class="blockCell">{{ item.TName }}</div>
            <span class="sub-cell">暂无描述</span>
          </div>
        </eagle-cell>
      </template>
    </eagle-page-list>
  </div>
</template>
<script>
export default {
  data() {
    return {
      list: [],
      conditions: {},
      queryParams: {
        dataType: "RiskUnitTemplate",
        ruCode: '',
      },
      isJG:false
    };
  },
  created() {
    this.isJG= this.$store.state.CompanyType=='JG'
    if (this.$route.query.ruCode) {
      const ruCode = this.$route.query.ruCode;
      this.queryParams.ruCode = ruCode;
    }
  },
  methods: {
    bindData(data) {
      this.list = [];
      if (data) {
        this.list = data;
      }
    },
    toDangerTemplate(item) {
      let url = this.isJG?"/Danger/DangerTemplateDetailJG":"/Danger/DangerTemplateDetail"
      this.$router.push({
        path: url,
        query: {
          areaCode: this.$route.query.areaCode,
          areaName: this.$route.query.areaName,
          areaType: this.$route.query.areaType,
          areaNo: this.$route.query.areaNo,
          tCode: item.TCode,
        },
      });
    },
  },
};
</script>
<style lang="less" scoped>
.risk {
  background: #e8f1f8;
}
.block {
  margin: 10px;
  background: #fff;
  padding: 10px;
  border-radius: 5px;
}
.blockCell {
  color: #333;
  font-size: 16px;
  line-height: 30px;
}
.info_search {
  padding: 10px;
  border-radius: 5px !important;
  .van-field__control {
    background-color: #ffffff !important;
  }
}
.sub-cell {
  color: #666;
  font-size: 12px;
  line-height: 25px;
}
</style>
